<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>basic_outcome&lt;T, EC, EP, NoValuePolicy&gt; - Boost.Outcome documentation</title>
<link rel="stylesheet" href="../../css/boost.css" type="text/css">
<meta name="generator" content="Hugo 0.52 with Boostdoc theme">
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>

<link rel="icon" href="../../images/favicon.ico" type="image/ico"/>
<body><div class="spirit-nav">
<a accesskey="p" href="../../reference/types.html"><img src="../../images/prev.png" alt="Prev"></a>
    <a accesskey="u" href="../../reference/types.html"><img src="../../images/up.png" alt="Up"></a>
    <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/types/basic_outcome/default.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content">

  <div class="titlepage"><div><div><h1 style="clear: both"><code>basic_outcome&lt;T, EC, EP, NoValuePolicy&gt;</code></h1></div></div></div>
  <div class="toc"><dl class="toc">
<dt>
<dd><dl>
<dt>
<dd><dl>
<dt><a href="#design-rationale">Design rationale</a></dt>
<dt><a href="#public-member-type-aliases">Public member type aliases</a></dt>
<dt><a href="#protected-member-predicate-booleans">Protected member predicate booleans</a>
<dd><dl>
<dt><a href="#summary-of-standard-requirements-provided-https-en-cppreference-com-w-cpp-named-req">Summary of <a href="https://en.cppreference.com/w/cpp/named_req">standard requirements provided</a></a></dt>
</dl></dd></dt>
<dt><a href="#public-member-functions">Public member functions</a>
<dd><dl>
<dt><a href="#disabling-constructors">Disabling constructors</a></dt>
</dl></dd></dt>
</dl></dd></dt>
</dl></dd></dt>
</dl>
  </div>


<p>A type carrying one of (i) a successful <code>T</code> (ii) a disappointment <code>EC</code> (iii) a failure <code>EP</code> (iv) both a disappointment <code>EC</code> and a failure <code>EP</code>, with <code>NoValuePolicy</code> specifying what to do if one tries to read state which isn&rsquo;t there, and enabling injection of hooks to trap when lifecycle events occur. Any one, two, or all of <code>T</code>, <code>EC</code> and <code>EP</code> can be <code>void</code> to indicate no value for that state is present. Detectable using <a href="../../reference/traits/is_basic_outcome.html" class="api-reference"><code>is_basic_outcome&lt;T&gt;</code></a>
.</p>

<p><em>Requires</em>: Concept requirements if C++ 20, else static asserted:</p>

<ul>
<li>That trait <a href="../../reference/traits/type_can_be_used_in_basic_result.html" class="api-reference"><code>type_can_be_used_in_basic_result&lt;R&gt;</code></a>
 is true for <code>T</code>, <code>EC</code> and <code>EP</code>.</li>
<li>That either <code>EC</code> is <code>void</code> or <code>DefaultConstructible</code> (Outcome v2.1 and earlier only).</li>
<li>That either <code>EP</code> is <code>void</code> or <code>DefaultConstructible</code>.</li>
</ul>

<p><em>Namespace</em>: <code>BOOST_OUTCOME_V2_NAMESPACE</code></p>

<p><em>Header</em>: <code>&lt;boost/outcome/basic_outcome.hpp&gt;</code></p>

<p><em>Inclusions</em>: The very lightest weight of C and C++ header files:</p>

<ol>
<li><code>&lt;cstdint&gt;</code></li>
<li><code>&lt;initializer_list&gt;</code></li>
<li><code>&lt;iosfwd&gt;</code></li>
<li><code>&lt;new&gt;</code></li>
<li><code>&lt;type_traits&gt;</code></li>
<li>If <a href="../../reference/macros/in_place_type.html" class="api-reference"><code>BOOST_OUTCOME_USE_STD_IN_PLACE_TYPE</code></a>
 is <code>1</code>, <code>&lt;utility&gt;</code> (defaults to <code>1</code> for C++ 17 or later only)</li>
<li>If C++ exceptions disabled and <code>BOOST_OUTCOME_DISABLE_EXECINFO</code> undefined only (used to print stack backtraces on &ldquo;exception throw&rdquo;):

<ol>
<li><code>&lt;sal.h&gt;</code> (Windows only)</li>
<li><code>&lt;stddef.h&gt;</code> (Windows only)</li>
<li><code>&lt;string.h&gt;</code> (Windows only)</li>
<li><code>&lt;execinfo.h&gt;</code> (POSIX only)</li>
</ol></li>
<li><code>&lt;cstdio&gt;</code></li>
<li><code>&lt;cstdlib&gt;</code></li>
<li><code>&lt;cassert&gt;</code></li>
</ol>

<p>This very light weight set of inclusion dependencies makes basic outcome suitable for use in global header files of very large C++ codebases.</p>

<h3 id="design-rationale">Design rationale</h3>

<p><code>basic_outcome</code> extends <a href="../../reference/types/basic_result.html" class="api-reference"><code>basic_result&lt;T, E, NoValuePolicy&gt;</code></a>
 with a third state to transport,
conventionally (but not necessarily) some sort of &ldquo;abort&rdquo; or &ldquo;exceptional&rdquo; state which a function can
return to indicate that not only did the operation fail, but it did so <em>catastrophically</em> i.e. please
abort any attempt to retry the operation.</p>

<p>A perfect alternative is to throw a C++ exception for the abort code path, and indeed most programs
ought to do exactly that instead of using <code>basic_outcome</code>. However there are a number of use cases
where choosing <code>basic_outcome</code> shines:</p>

<ol>
<li>Where C++ exceptions or RTTI is not available, but the ability to fail catastrophically without
terminating the program is important.</li>
<li>Where deterministic behaviour is required even in the catastrophic failure situation.</li>
<li>In unit test suites of code using Outcome it is extremely convenient to accumulate test failures
into a <code>basic_outcome</code> for later reporting. A similar convenience applies to RPC situations, where
C++ exception throws need to be accumulated for reporting back to the initiating endpoint.</li>
<li>Where a function is &ldquo;dual use deterministic&rdquo; i.e. it can be used deterministically, in which case
one switches control flow based on <code>.error()</code>, or it can be used non-deterministically by throwing
an exception perhaps carrying a custom payload.</li>
</ol>

<h3 id="public-member-type-aliases">Public member type aliases</h3>

<ul>
<li><code>value_type</code> is <code>T</code>.</li>
<li><code>error_type</code> is <code>EC</code>.</li>
<li><code>exception_type</code> is <code>EP</code>.</li>
<li><code>no_value_policy_type</code> is <code>NoValuePolicy</code>.</li>
<li><code>value_type_if_enabled</code> is <code>T</code> if construction from <code>T</code> is available, else it is a usefully named unusable internal type.</li>
<li><code>error_type_if_enabled</code> is <code>EC</code> if construction from <code>EC</code> is available, else it is a usefully named unusable internal type.</li>
<li><code>exception_type_if_enabled</code> is <code>EP</code> if construction from <code>EP</code> is available, else it is a usefully named unusable internal type.</li>
<li><code>rebind&lt;A, B = EC, C = EP, D = NoValuePolicy&gt;</code> is <code>basic_outcome&lt;A, B, C, D&gt;</code>.</li>
</ul>

<h3 id="protected-member-predicate-booleans">Protected member predicate booleans</h3>

<ul>
<li><p><code>predicate::constructors_enabled</code> is constexpr boolean true if:</p>

<ol>
<li>Decayed <code>value_type</code> and decayed <code>error_type</code> are not the same type, or both are <code>void</code>.</li>
<li>Decayed <code>value_type</code> and decayed <code>exception_type</code> are not the same type, or both are <code>void</code>.</li>
<li>Decayed <code>error_type</code> and decayed <code>exception_type</code> are not the same type, or both are <code>void</code>.</li>
</ol></li>

<li><p><code>predicate::implicit_constructors_enabled</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li>Trait <a href="../../reference/traits/is_error_type.html" class="api-reference"><code>is_error_type&lt;E&gt;</code></a>
 is not true for both decayed <code>value_type</code> and decayed <code>error_type</code> at the same time.</li>
<li><code>value_type</code> is not implicitly constructible from <code>error_type</code> and <code>error_type</code> is not implicitly constructible from <code>value_type</code>.<br>OR<br>trait <a href="../../reference/traits/is_error_type.html" class="api-reference"><code>is_error_type&lt;E&gt;</code></a>
 is true for decayed <code>error_type</code> and <code>error_type</code> is not implicitly constructible from <code>value_type</code> and <code>value_type</code> is an integral type.</li>
<li><code>value_type</code> is not implicitly constructible from <code>exception_type</code>.</li>
<li><code>error_type</code> is not implicitly constructible from <code>exception_type</code>.</li>
<li><code>exception_type</code> is not implicitly constructible from <code>value_type</code>.</li>
<li><code>exception_type</code> is not implicitly constructible from <code>error_type</code>.</li>
</ol></li>

<li><p><code>predicate::enable_value_converting_constructor&lt;A&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li>Decayed <code>A</code> is not this <code>basic_outcome</code> type.</li>
<li><code>predicate::implicit_constructors_enabled</code> is true.</li>
<li>Decayed <code>A</code> is not an <code>in_place_type_t</code>.</li>
<li>Trait <a href="../../reference/traits/is_error_type_enum.html" class="api-reference"><code>is_error_type_enum&lt;E, Enum&gt;</code></a>
 is false for <code>error_type</code> and decayed <code>A</code>.</li>
<li><code>value_type</code> is implicitly constructible from <code>A</code> and <code>error_type</code> is not implicitly constructible from <code>A</code>.<br>OR<br><code>value_type</code> is the exact same type as decayed <code>A</code> and <code>value_type</code> is implicitly constructible from <code>A</code>.</li>
<li><code>exception_type</code> is not implicitly constructible from <code>A</code>.</li>
</ol></li>

<li><p><code>predicate::enable_error_converting_constructor&lt;A&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li>Decayed <code>A</code> is not this <code>basic_outcome</code> type.</li>
<li><code>predicate::implicit_constructors_enabled</code> is true.</li>
<li>Decayed <code>A</code> is not an <code>in_place_type_t</code>.</li>
<li>Trait <a href="../../reference/traits/is_error_type_enum.html" class="api-reference"><code>is_error_type_enum&lt;E, Enum&gt;</code></a>
 is false for <code>error_type</code> and decayed <code>A</code>.</li>
<li><code>value_type</code> is not implicitly constructible from <code>A</code> and <code>error_type</code> is implicitly constructible from <code>A</code>.<br>OR<br><code>error_type</code> is the exact same type as decayed <code>A</code> and <code>error_type</code> is implicitly constructible from <code>A</code>.</li>
<li><code>exception_type</code> is not implicitly constructible from <code>A</code>.</li>
</ol></li>

<li><p><code>predicate::enable_error_condition_converting_constructor&lt;ErrorCondEnum&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li>Decayed <code>ErrorCondEnum</code> is not this <code>basic_outcome</code> type.</li>
<li>Decayed <code>ErrorCondEnum</code> is not an <code>in_place_type_t</code>.</li>
<li>Trait <a href="../../reference/traits/is_error_type_enum.html" class="api-reference"><code>is_error_type_enum&lt;E, Enum&gt;</code></a>
 is true for <code>error_type</code> and decayed <code>ErrorCondEnum</code>.</li>
<li><code>exception_type</code> is not implicitly constructible from <code>ErrorCondEnum</code>.</li>
</ol></li>

<li><p><code>predicate::enable_exception_converting_constructor&lt;A&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li>Decayed <code>A</code> is not this <code>basic_outcome</code> type.</li>
<li><code>predicate::implicit_constructors_enabled</code> is true.</li>
<li>Decayed <code>A</code> is not an <code>in_place_type_t</code>.</li>
<li><code>value_type</code> is not implicitly constructible from <code>A</code>.</li>
<li><code>error_type</code> is not implicitly constructible from <code>A</code>.</li>
<li><code>exception_type</code> is implicitly constructible from <code>A</code>.</li>
</ol></li>

<li><p><code>predicate::enable_error_exception_converting_constructor&lt;A, B&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li>Decayed <code>A</code> is not this <code>basic_outcome</code> type.</li>
<li><code>predicate::implicit_constructors_enabled</code> is true.</li>
<li>Decayed <code>A</code> is not an <code>in_place_type_t</code>.</li>
<li><code>value_type</code> is not implicitly constructible from <code>A</code>.</li>
<li><code>error_type</code> is implicitly constructible from <code>A</code>.</li>
<li><code>value_type</code> is not implicitly constructible from <code>B</code>.</li>
<li><code>exception_type</code> is implicitly constructible from <code>B</code>.</li>
</ol></li>

<li><p><code>predicate::enable_compatible_conversion&lt;A, B, C, D&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li><code>basic_outcome&lt;A, B, C, D&gt;</code> is not this <code>basic_outcome</code> type.</li>
<li><code>A</code> is <code>void</code> OR <code>value_type</code> is explicitly constructible from <code>A</code>.</li>
<li><code>B</code> is <code>void</code> OR <code>error_type</code> is explicitly constructible from <code>B</code>.</li>
<li><code>C</code> is <code>void</code> OR <code>exception_type</code> is explicitly constructible from <code>C</code>.</li>
</ol></li>

<li><p><code>predicate::enable_make_error_code_compatible_conversion&lt;A, B, C, D&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li><code>basic_outcome&lt;A, B, C, D&gt;</code> is not this <code>basic_outcome</code> type.</li>
<li>Trait <a href="../../reference/traits/is_error_code_available.html" class="api-reference"><code>is_error_code_available&lt;T&gt;</code></a>
 is true for decayed <code>error_type</code>.</li>
<li><code>predicate::enable_compatible_conversion&lt;A, B, C, D&gt;</code> is not true.</li>
<li><code>A</code> is <code>void</code> OR <code>value_type</code> is explicitly constructible from <code>A</code>.</li>
<li><code>error_type</code> is explicitly constructible from <code>make_error_code(B)</code>.</li>
<li><code>C</code> is <code>void</code> OR <code>exception_type</code> is explicitly constructible from <code>C</code>.</li>
</ol></li>

<li><p><code>predicate::enable_inplace_value_constructor&lt;Args...&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li><code>value_type</code> is <code>void</code> OR <code>value_type</code> is explicitly constructible from <code>Args...</code>.</li>
</ol></li>

<li><p><code>predicate::enable_inplace_error_constructor&lt;Args...&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li><code>error_type</code> is <code>void</code> OR <code>error_type</code> is explicitly constructible from <code>Args...</code>.</li>
</ol></li>

<li><p><code>predicate::enable_inplace_exception_constructor&lt;Args...&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li><code>exception_type</code> is <code>void</code> OR <code>exception_type</code> is explicitly constructible from <code>Args...</code>.</li>
</ol></li>

<li><p><code>predicate::enable_inplace_value_error_exception_constructor&lt;Args...&gt;</code> is constexpr boolean true if:</p>

<ol>
<li><code>predicate::constructors_enabled</code> is true.</li>
<li><code>predicate::implicit_constructors_enabled</code> is true.</li>
<li>Exactly one of <code>value_type</code> is explicitly constructible from <code>Args...</code>, or <code>error_type</code> is explicitly constructible from <code>Args...</code>, or <code>exception_type</code> is explicitly constructible
from <code>Args...</code>.</li>
</ol></li>
</ul>

<h4 id="summary-of-standard-requirements-provided-https-en-cppreference-com-w-cpp-named-req">Summary of <a href="https://en.cppreference.com/w/cpp/named_req">standard requirements provided</a></h4>

<ul>
<li><del><code>DefaultConstructible</code></del>, always deleted to force user to choose valued or errored or excepted for every outcome instanced.</li>
<li><code>MoveConstructible</code>, if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> implement move constructors.</li>
<li><code>CopyConstructible</code>, if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> implement copy constructors.</li>
<li><code>MoveAssignable</code>, if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> implement move constructors and move assignment.</li>
<li><code>CopyAssignable</code>, if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> implement copy constructors and copy assignment.</li>
<li><code>Destructible</code>.</li>
<li><code>Swappable</code>, with the strong rather than weak guarantee. See <a href="../../reference/types/basic_outcome/swap.html" class="api-reference"><code>void swap(basic_outcome &amp;)</code></a>
 for more information.</li>
<li><code>TriviallyCopyable</code>, if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> are trivially copyable.</li>
<li><code>TrivialType</code>, if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> are trivial types.</li>
<li><code>LiteralType</code>, if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> are literal types.</li>

<li><p><del><code>StandardLayoutType</code></del>. It is implementation defined if <code>basic_outcome</code> can be used by C.
However all of the three major compilers MSVC, GCC and clang implement C layout of <code>basic_outcome</code> as follows:</p>
<div class="highlight"><pre class="chroma"><code class="language-c++" data-lang="c++"><span class="k">struct</span> <span class="n">outcome_layout</span> <span class="p">{</span>
  <span class="k">struct</span> <span class="n">trivially_copyable_result_layout</span> <span class="p">{</span>
    <span class="k">union</span> <span class="p">{</span>
      <span class="n">value_type</span> <span class="n">value</span><span class="p">;</span>
      <span class="n">error_type</span> <span class="n">error</span><span class="p">;</span>
    <span class="p">};</span>
    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">flags</span><span class="p">;</span>
  <span class="p">};</span>
  <span class="n">exception_type</span> <span class="n">exception</span><span class="p">;</span>
<span class="p">};</span>
</code></pre></div>
<p>&hellip; if both <code>value_type</code> and <code>error_type</code> are <code>TriviallyCopyable</code>, otherwise:</p>
<div class="highlight"><pre class="chroma"><code class="language-c++" data-lang="c++"><span class="k">struct</span> <span class="n">outcome_layout</span> <span class="p">{</span>
  <span class="k">struct</span> <span class="n">non_trivially_copyable_result_layout</span> <span class="p">{</span>
    <span class="n">value_type</span> <span class="n">value</span><span class="p">;</span>
    <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">flags</span><span class="p">;</span>
    <span class="n">error_type</span> <span class="n">error</span><span class="p">;</span>
  <span class="p">};</span>
  <span class="n">exception_type</span> <span class="n">exception</span><span class="p">;</span>
<span class="p">};</span>
</code></pre></div>
<p>If you choose standard layout <code>value_type</code>, <code>error_type</code> and <code>exception_type</code>, <code>basic_outcome</code>
works fine from C on MSVC, GCC and clang.</p></li>

<li><p><code>EqualityComparable</code>, if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> implement equality comparisons with one another.</p></li>

<li><p><del><code>LessThanComparable</code></del>, not implemented due to availability of implicit conversions from <code>value_type</code>, <code>error_type</code> and <code>exception_type</code>, this can cause major surprise (i.e. hard to diagnose bugs), so we don&rsquo;t implement these at all.</p></li>

<li><p><del><code>Hash</code></del>, not implemented as a generic implementation of a unique hash for non-valued items which are unequal would require a dependency on RTTI being enabled.</p></li>
</ul>

<p>Thus <code>basic_outcome</code> meets the <code>Regular</code> concept if all of <code>value_type</code>, <code>error_type</code> and <code>exception_type</code> are <code>Regular</code>, except for the lack of a default constructor. Often where one needs a default constructor, wrapping <code>basic_outcome</code> into 
<a href="https://en.cppreference.com/w/cpp/utility/optional" class="api-reference" target="_blank"><i class="fa fa-book" aria-hidden="true"></i> <code>std::optional&lt;T&gt;</code></a>
 will suffice.</p>

<h3 id="public-member-functions">Public member functions</h3>

<h4 id="disabling-constructors">Disabling constructors</h4>

<ol class="children children-li"><li>
	<a href="../../reference/types/basic_outcome/disabling_catchall.html" ><code>basic_outcome(Args...) = delete</code></a>
<p>Disabling catchall constructor used to give useful diagnostic error when trying to use non-inplace constructors when <code>predicate::constructors_enabled</code> is false.</p><li>
	<a href="../../reference/types/basic_outcome/disabling_implicit_constructor.html" ><code>basic_outcome(X &amp;&amp;) = delete</code></a>
<p>Disabling implicit constructor used to give useful diagnostic error when trying to use implicit constructors when <code>predicate::implicit_constructors_enabled</code> is false.</p></li></ol>

<h4 id="copy-and-move-constructors-and-assignment-and-destructor">Copy and move constructors and assignment, and destructor</h4>

<ol class="children children-li"><li>
    <a href="../../reference/types/basic_outcome/default.html" ><code>basic_outcome() = delete</code></a>
<p>The default constructor (disabled).</p><li>
    <a href="../../reference/types/basic_outcome/move_constructor.html" ><code>basic_outcome(basic_outcome &amp;&amp;)</code></a>
<p>Move constructor. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/copy_constructor.html" ><code>basic_outcome(const basic_outcome &amp;)</code></a>
<p>Copy constructor. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/move_assignment.html" ><code>basic_outcome &amp;operator=(basic_outcome &amp;&amp;)</code></a>
<p>Move assignment. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/copy_assignment.html" ><code>basic_outcome &amp;operator=(const basic_outcome &amp;)</code></a>
<p>Copy assignment. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/destructor.html" ><code>~basic_outcome()</code></a>
<p>Destructor. Constexpr, triviality and noexcept propagating.</p></li></ol>

<h4 id="converting-constructors">Converting constructors</h4>

<ol class="children children-li"><li>
    <a href="../../reference/types/basic_outcome/implicit_value_converting_constructor.html" ><code>basic_outcome(R &amp;&amp;)</code></a>
<p>Implicit <code>value_type</code> constructor. Available if <code>predicate::enable_value_converting_constructor&lt;R&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_error_converting_constructor.html" ><code>basic_outcome(S &amp;&amp;)</code></a>
<p>Implicit <code>error_type</code> constructor. Available if <code>predicate::enable_error_converting_constructor&lt;S&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_error_condition_converting_constructor.html" ><code>basic_outcome(ErrorCondEnum &amp;&amp;)</code></a>
<p>Implicit <code>error_type</code> from <code>ErrorCondEnum</code> constructor. Available if <code>predicate::enable_error_condition_converting_constructor&lt;ErrorCondEnum&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_exception_converting_constructor.html" ><code>basic_outcome(P &amp;&amp;)</code></a>
<p>Implicit <code>exception_type</code> constructor. Available if <code>predicate::enable_exception_converting_constructor&lt;P&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_error_exception_converting_constructor.html" ><code>basic_outcome(S &amp;&amp;, P &amp;&amp;)</code></a>
<p>Implicit <code>error_type</code> + <code>exception_type</code> constructor. Available if <code>predicate::enable_error_exception_converting_constructor&lt;S, P&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_valueorerror_converting_constructor.html" ><code>explicit basic_outcome(concepts::value_or_error&lt;T, E&gt; &amp;&amp;)</code></a>
<p>Explicit converting constructor from <code>concepts::value_or_error&lt;T, E&gt;</code> concept matching types. Available if <code>convert::value_or_error&lt;&gt;</code> permits it. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_copy_converting_constructor.html" ><code>explicit basic_outcome(const basic_outcome&lt;A, B, C, D&gt; &amp;)</code></a>
<p>Explicit converting copy constructor from compatible <code>basic_outcome</code>. Available if <code>predicate::enable_compatible_conversion&lt;A, B, C, D&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_move_converting_constructor.html" ><code>explicit basic_outcome(basic_outcome&lt;A, B, C, D&gt; &amp;&amp;)</code></a>
<p>Explicit converting move constructor from compatible <code>basic_outcome</code>. Available if <code>predicate::enable_compatible_conversion&lt;A, B, C, D&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_result_copy_converting_constructor.html" ><code>explicit basic_outcome(const basic_result&lt;A, B, C&gt; &amp;)</code></a>
<p>Explicit converting copy constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_compatible_conversion&lt;A, B, void, C&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_result_move_converting_constructor.html" ><code>explicit basic_outcome(basic_result&lt;A, B, C&gt; &amp;&amp;)</code></a>
<p>Explicit converting move constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_compatible_conversion&lt;A, B, void, C&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_result_make_error_code_copy_converting_constructor.html" ><code>explicit basic_outcome(const basic_result&lt;A, B, C&gt; &amp;)</code></a>
<p>Explicit converting copy constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_make_error_code_compatible_conversion&lt;A, B, void, C&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_result_make_error_code_move_converting_constructor.html" ><code>explicit basic_outcome(basic_result&lt;A, B, C&gt; &amp;&amp;)</code></a>
<p>Explicit converting move constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_make_error_code_compatible_conversion&lt;A, B, void, C&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p></li></ol>

<h4 id="inplace-constructors">Inplace constructors</h4>

<ol class="children children-li"><li>
    <a href="../../reference/types/basic_outcome/explicit_inplace_value_constructor.html" ><code>explicit basic_outcome(in_place_type_t&lt;value_type_if_enabled&gt;, Args ...)</code></a>
<p>Explicit inplace value constructor. Available if <code>predicate::enable_inplace_value_constructor&lt;Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_inplace_value_constructor_il.html" ><code>explicit basic_outcome(in_place_type_t&lt;value_type_if_enabled&gt;, std::initializer_list&lt;U&gt;, Args ...)</code></a>
<p>Explicit inplace value constructor. Available if <code>predicate::enable_inplace_value_constructor&lt;std::initializer_list&lt;U&gt;, Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_inplace_error_constructor.html" ><code>explicit basic_outcome(in_place_type_t&lt;error_type_if_enabled&gt;, Args ...)</code></a>
<p>Explicit inplace error constructor. Available if <code>predicate::enable_inplace_error_constructor&lt;Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_inplace_error_constructor_il.html" ><code>explicit basic_outcome(in_place_type_t&lt;error_type_if_enabled&gt;, std::initializer_list&lt;U&gt;, Args ...)</code></a>
<p>Explicit inplace error constructor. Available if <code>predicate::enable_inplace_error_constructor&lt;std::initializer_list&lt;U&gt;, Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_inplace_exception_constructor.html" ><code>explicit basic_outcome(in_place_type_t&lt;exception_type_if_enabled&gt;, Args ...)</code></a>
<p>Explicit inplace exception constructor. Available if <code>predicate::enable_inplace_exception_constructor&lt;Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/explicit_inplace_exception_constructor_il.html" ><code>explicit basic_outcome(in_place_type_t&lt;exception_type_if_enabled&gt;, std::initializer_list&lt;U&gt;, Args ...)</code></a>
<p>Explicit inplace exception constructor. Available if <code>predicate::enable_inplace_exception_constructor&lt;std::initializer_list&lt;U&gt;, Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_inplace_value_error_exception_constructor.html" ><code>basic_outcome(A1 &amp;&amp;, A2 &amp;&amp;, Args ...)</code></a>
<p>Implicit inplace value or error or exception constructor. Available if <code>predicate::enable_inplace_value_error_exception_constructor&lt;A1, A2, Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p></li></ol>

<h4 id="tagged-constructors">Tagged constructors</h4>

<ol class="children children-li"><li>
    <a href="../../reference/types/basic_outcome/implicit_success_copy_constructor.html" ><code>basic_outcome(const success_type&lt;T&gt; &amp;)</code></a>
<p>Implicit value-from-success-type-sugar copy constructor. Available if <code>predicate::enable_compatible_conversion&lt;T, void, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_success_move_constructor.html" ><code>basic_outcome(success_type&lt;T&gt; &amp;&amp;)</code></a>
<p>Implicit value-from-success-type-sugar move constructor. Available if <code>predicate::enable_compatible_conversion&lt;T, void, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_failure_error_copy_constructor.html" ><code>basic_outcome(const failure_type&lt;EC&gt; &amp;)</code></a>
<p>Implicit error-from-failure-type-sugar copy constructor. Available if <code>predicate::enable_compatible_conversion&lt;void, EC, void, void&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_failure_error_move_constructor.html" ><code>basic_outcome(failure_type&lt;EC&gt; &amp;&amp;)</code></a>
<p>Implicit error-from-failure-type-sugar move constructor. Available if <code>predicate::enable_compatible_conversion&lt;void, EC, void, void&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_failure_error_make_error_code_copy_constructor.html" ><code>basic_outcome(const failure_type&lt;EC&gt; &amp;)</code></a>
<p>Implicit error-from-failure-type-sugar copy constructor. Available if <code>predicate::enable_make_error_code_compatible_conversion&lt;void, EC, void, void&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_failure_error_make_error_code_move_constructor.html" ><code>basic_outcome(failure_type&lt;EC&gt; &amp;&amp;)</code></a>
<p>Implicit error-from-failure-type-sugar move constructor. Available if <code>predicate::enable_make_error_code_compatible_conversion&lt;void, EC, void, void&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_failure_exception_copy_constructor.html" ><code>basic_outcome(const failure_type&lt;EP&gt; &amp;)</code></a>
<p>Implicit exception-from-failure-type-sugar copy constructor. Available if <code>predicate::enable_compatible_conversion&lt;void, void, EP, void&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_failure_exception_move_constructor.html" ><code>basic_outcome(failure_type&lt;EP&gt; &amp;&amp;)</code></a>
<p>Implicit exception-from-failure-type-sugar move constructor. Available if <code>predicate::enable_compatible_conversion&lt;void, void, EP, void&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_failure_error_exception_copy_constructor.html" ><code>basic_outcome(const failure_type&lt;EC, EP&gt; &amp;)</code></a>
<p>Implicit error-and-exception-from-failure-type-sugar copy constructor. Available if <code>predicate::enable_compatible_conversion&lt;void, EC, EP, void&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/implicit_failure_error_exception_move_constructor.html" ><code>basic_outcome(failure_type&lt;EC, EP&gt; &amp;&amp;)</code></a>
<p>Implicit error-and-exception-from-failure-type-sugar move constructor. Available if <code>predicate::enable_compatible_conversion&lt;void, EC, EP, void&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p></li></ol>

<h4 id="observers">Observers</h4>

<ol class="children children-li"><li>
    <a href="../../reference/types/basic_outcome/operator_bool.html" ><code>explicit operator bool() const noexcept</code></a>
<p>Returns true if a value is present. Constexpr, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/has_value.html" ><code>bool has_value() const noexcept</code></a>
<p>Returns true if a value is present. Constexpr, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/has_error.html" ><code>bool has_error() const noexcept</code></a>
<p>Returns true if an error is present. Constexpr, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/has_exception.html" ><code>bool has_exception() const noexcept</code></a>
<p>Returns true if an exception is present. Constexpr, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/has_failure.html" ><code>bool has_failure() const noexcept</code></a>
<p>Returns true if there is either an error or an exception. Constexpr, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_value_lvalue.html" ><code>value_type &amp;assume_value() &amp; noexcept</code></a>
<p>Narrow contract lvalue reference observer of any value present. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_value_lvalue_const.html" ><code>const value_type &amp;assume_value() const &amp; noexcept</code></a>
<p>Narrow contract const lvalue reference observer of any value present. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_value_rvalue.html" ><code>value_type &amp;&amp;assume_value() &amp;&amp; noexcept</code></a>
<p>Narrow contract rvalue reference observer of any value present. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_value_rvalue_const.html" ><code>const value_type &amp;&amp;assume_value() const &amp;&amp; noexcept</code></a>
<p>Narrow contract const rvalue reference observer of any value present. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/value_lvalue.html" ><code>value_type &amp;value() &amp;</code></a>
<p>Wide contract lvalue reference observer of any value present. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/value_lvalue_const.html" ><code>const value_type &amp;value() const &amp;</code></a>
<p>Wide contract const lvalue reference observer of any value present. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/value_rvalue.html" ><code>value_type &amp;&amp;value() &amp;&amp;</code></a>
<p>Wide contract rvalue reference observer of any value present. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/value_rvalue_const.html" ><code>const value_type &amp;&amp;value() const &amp;&amp;</code></a>
<p>Wide contract const rvalue reference observer of any value present. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/assume_error_lvalue.html" ><code>error_type &amp;assume_error() &amp; noexcept</code></a>
<p>Narrow contract lvalue reference observer of the stored error. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_error_lvalue_const.html" ><code>const error_type &amp;assume_error() const &amp; noexcept</code></a>
<p>Narrow contract const lvalue reference observer of the stored error. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_error_rvalue.html" ><code>error_type &amp;&amp;assume_error() &amp;&amp; noexcept</code></a>
<p>Narrow contract rvalue reference observer of the stored error. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_error_rvalue_const.html" ><code>const error_type &amp;&amp;assume_error() const &amp;&amp; noexcept</code></a>
<p>Narrow contract const rvalue reference observer of the stored error. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/error_lvalue.html" ><code>error_type &amp;error() &amp;</code></a>
<p>Wide contract lvalue reference observer of the stored error. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/error_lvalue_const.html" ><code>const error_type &amp;error() const &amp;</code></a>
<p>Wide contract const lvalue reference observer of the stored error. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/error_rvalue.html" ><code>error_type &amp;&amp;error() &amp;&amp;</code></a>
<p>Wide contract rvalue reference observer of the stored error. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/error_rvalue_const.html" ><code>const error_type &amp;&amp;error() const &amp;&amp;</code></a>
<p>Wide contract const rvalue reference observer of the stored error. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/assume_exception_lvalue.html" ><code>exception_type &amp;assume_exception() &amp; noexcept</code></a>
<p>Narrow contract lvalue reference observer of the stored exception. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_exception_lvalue_const.html" ><code>const exception_type &amp;assume_exception() const &amp; noexcept</code></a>
<p>Narrow contract const lvalue reference observer of the stored exception. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_exception_rvalue_const.html" ><code>const exception_type &amp;&amp;assume_exception() const &amp;&amp; noexcept</code></a>
<p>Narrow contract const rvalue reference observer of the stored exception. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/assume_exception_rvalue.html" ><code>exception_type &amp;&amp;assume_exception() &amp;&amp; noexcept</code></a>
<p>Narrow contract rvalue reference observer of the stored exception. Constexpr propagating, never throws.</p><li>
    <a href="../../reference/types/basic_outcome/exception_lvalue.html" ><code>exception_type &amp;exception() &amp;</code></a>
<p>Wide contract lvalue reference observer of the stored exception. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/exception_lvalue_const.html" ><code>const exception_type &amp;exception() const &amp;</code></a>
<p>Wide contract const lvalue reference observer of the stored exception. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/exception_rvalue.html" ><code>exception_type &amp;&amp;exception() &amp;&amp;</code></a>
<p>Wide contract rvalue reference observer of the stored exception. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/exception_rvalue_const.html" ><code>const exception_type &amp;&amp;exception() const &amp;&amp;</code></a>
<p>Wide contract const rvalue reference observer of the stored exception. Constexpr propagating.</p><li>
    <a href="../../reference/types/basic_outcome/failure.html" ><code>exception_type failure() const noexcept</code></a>
<p>Synthesising observer of the stored exception or error. Available if the traits <code>is_error_code_available&lt;T&gt;</code> and <code>is_exception_ptr_available&lt;T&gt;</code> are both true. Never throws.</p><li>
    <a href="../../reference/types/basic_outcome/as_failure_lvalue.html" ><code>failure_type&lt;error_type, exception_type&gt; as_failure() const &amp;</code></a>
<p>Return the output from free function <code>failure()</code> containing a copy of any errored and/or excepted state.</p></li></ol>

<h4 id="modifiers">Modifiers</h4>

<ol class="children children-li"><li>
    <a href="../../reference/types/basic_outcome/swap.html" ><code>void swap(basic_outcome &amp;)</code></a>
<p>Swap one basic_outcome with another, with the strong guarantee. Noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/as_failure_rvalue.html" ><code>failure_type&lt;error_type, exception_type&gt; as_failure() &amp;&amp;</code></a>
<p>Return the output from free function <code>failure()</code> containing a move of any errored and/or excepted state.</p></li></ol>

<h4 id="comparisons">Comparisons</h4>

<p>See above for why <code>LessThanComparable</code> is not implemented.</p>

<ol class="children children-li"><li>
    <a href="../../reference/types/basic_outcome/equality_basic_result.html" ><code>bool operator==(const basic_result&lt;A, B, C&gt; &amp;) const</code></a>
<p>Returns true if this outcome compares equal to the other result. Constexpr and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/equality_basic_outcome.html" ><code>bool operator==(const basic_outcome&lt;A, B, C, D&gt; &amp;) const</code></a>
<p>Returns true if this outcome compares equal to the other outcome. Constexpr and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/inequality_success_type.html" ><code>bool operator==(const success_type&lt;A&gt; &amp;) const</code></a>
<p>Returns true if this result compares equal to the success type sugar. Constexpr and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/equality_failure_type.html" ><code>bool operator==(const failure_type&lt;A, B&gt; &amp;) const</code></a>
<p>Returns true if this outcome compares equal to the failure type sugar. Constexpr and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/inequality_basic_result.html" ><code>bool operator!=(const basic_result&lt;A, B, C&gt; &amp;) const</code></a>
<p>Returns true if this outcome does not compare equal to the other result. Constexpr and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/inequality_basic_outcome.html" ><code>bool operator!=(const basic_outcome&lt;A, B, C, D&gt; &amp;) const</code></a>
<p>Returns true if this outcome does not compare equal to the other outcome. Constexpr and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/equality_success_type.html" ><code>bool operator!=(const success_type&lt;A&gt; &amp;) const</code></a>
<p>Returns true if this outcome does not compare equal to the success type sugar. Constexpr and noexcept propagating.</p><li>
    <a href="../../reference/types/basic_outcome/inequality_failure_type.html" ><code>bool operator!=(const failure_type&lt;A, B&gt; &amp;) const</code></a>
<p>Returns true if this outcome does not compare equal to the failure type sugar. Constexpr and noexcept propagating.</p></li></ol>







        </div><p><small>Last revised: December 17, 2020 at 11:27:06 UTC</small></p>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../reference/types.html"><img src="../../images/prev.png" alt="Prev"></a>
    <a accesskey="u" href="../../reference/types.html"><img src="../../images/up.png" alt="Up"></a>
    <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/types/basic_outcome/default.html"><img src="../../images/next.png" alt="Next"></a></div></body>
</html>
